<?php
error_reporting(E_ALL & E_STRICT | E_NOTICE);
$file = "./includes/definition_lodaers.php";
try {
	if(file_exists($file)){
		require_once($file);
		$loader = new Definitions_Loader();
		$files = array();
		$files = $loader->load();
		foreach($files as $key => $value){
			require_once "$value";
		}
	}
	else {
		throw new Exception('Plik z klasą ładującą ustawienia początkowe nie został znaleziony. Sprawdź, czy plik istnieje.');
	}
}
catch(Exception $e){
	return $e->getMessage();
}

function __autoload($class_name){
	$router = new Application_Router();
	$file_path = $router->load_class($class_name);
	include($file_path);
}

$router = new Application_Router();
$request_string = $_SERVER['QUERY_STRING'];
$post = array();
$post = $_POST;
$values = $router->controller_loader($request_string, $post);
print_r($values['files_value']['controller_path']);
print_r($values['files_value']['controller_class']);
try {
	require_once $values['files_value']['controller_path'];
	$controller = new $values['files_value']['controller_class'];
	$controller->main($values['get'], $values['post']);
}
catch(Exception $e){
	echo $e->getMessage();
}
/*
function __autoload($class_name){
	return $router->load($class_name);
}
return $router->initialize_controller();
*/